import http from "./http.js";
// 请求用户
async function getlogin(obj) {
  let { data } = await http.post("api/user/login.do?username="+obj.username+'&password='+obj.password);
  return data;
}
// 请求总数
async function getindex() {
  let { data } = await http.get("api/statistic/base_count.do");
  return data;
}
// 请求商品
async function getproduct(num) {
  let { data } = await http.get("api/product/list.do?pageNum="+num);
  return data;
}
// 商品搜索
async function getsearch(search) {
  let { data } = await http.get("api/product/search.do",{params:search});
  return data;
}
// 商品上下架
async function getstatus(status) {
  let { data } = await http.get("api/product/set_sale_status.do",{params:status});
  return data;
}
// 商品详情
async function getdetail(productId) {
  let { data } = await http.get("api/product/detail.do?productId="+productId);
  return data;
}
// 产品品类
async function getcategory(categoryId) {
  let { data } = await http.get("api/category/get_category.do?categoryId="+categoryId);
  return data;
}
// 新增 编辑更新
async function getsave(obj) {
  let { data } = await http.get("api/product/save.do",{params:obj});
  return data;
}
// 修改品类名字
async function setcategory(obj) {
  let { data } = await http.get("api/category/set_category_name.do",{params:obj});
  return data;
}
// 添加品类
async function setcateadd(obj) {
  let { data } = await http.get("api/category/add_category.do",{params:obj});
  return data;
}
// 请求用户
async function getuser(num) {
  let { data } = await http.post("api/user/list.do?pageNum="+num);
  return data;
}
// 获取订单
async function getorder(num) {
  let { data } = await http.post("api/order/list.do?pageNum="+num);
  return data;
}
// 订单查询

async function getOrderSearch(search) {
  let { data } = await http.get("api/order/search.do",{params:search});
  return data;
}
// 订单详情
async function getOrderDetail(orderNo) {
  let { data } = await http.get("api/order/detail.do?orderNo="+orderNo);
  return data;
}
export { getlogin,getindex,getproduct,getuser,getsearch,getstatus,getdetail,getcategory,getsave,setcategory,setcateadd,getorder,getOrderSearch,getOrderDetail };
